﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OrganizedIN.DAL;
using OrganizedIN.BAL;
using OrganizedIN.BussinessServices;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using OrganizedIN.BAL.Common;

namespace OrganizedIN.UI.ToDo
{
    public partial class archive_todos : System.Web.UI.Page
    {
        string strUserName;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                strUserName = Session["UserID"].ToString();
                if (!IsPostBack)
                {
                    BindList();
                }
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.ToString();
            }
        }

        public void BindList()
        {
            try
            {
                DataSet ds = new DataSet();
                ds = Common.Todo_ArchiveList(strUserName);
                gvTodoList.DataSource = ds.Tables[0];
                gvTodoList.DataBind();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblErrMsg.Text = "";
                }
                else
                {
                    lblErrMsg.Text = "No record(s) found.";
                }
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = ex.ToString();
            }
        }

        protected void gvTodoList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvTodoList.PageIndex = e.NewPageIndex;
            strUserName = Convert.ToString(Session["UserID"]);
            BindList();
        }

       
    }
}
